/*
 * Copyright (C) 2010 Juan José Ortilles jortilles@gmail.com
 *
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the Free 
 * Software Foundation; either version 3 of the License, or 
 * any later version.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * 
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 *
 */

/*Esta clase ya no se usa */
package net.juantxu.pentaho.launcher.utilidades;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.PrintWriter;

import org.apache.log4j.Logger;

public class CreaBat {
	static Logger log = Logger.getLogger(CreaBat.class);

	public CreaBat(String ruta, String ejecutable, String app) {	
			try {
				log.debug("creando el bat");
				PrintWriter escribir = new PrintWriter(new BufferedWriter(
						new FileWriter(app)));
				escribir.println("@echo off");
				escribir.println("REM Bat temporal para ejecutar una aplicació pentaho");
				escribir.println("REM Este archivo puede ser borrado ");
				escribir.println("REM Este archivo es creado y regenerado cada vez que sea necesario");
				escribir.println("@echo on");
				escribir.println("cd ".concat(ruta));
				escribir.println(ejecutable);
				// escribir.println("set /p choice=escrobe algo:");
				escribir.println("exit");
				escribir.close();
				log.debug("bat creado");
			} catch (Exception e) {
				log.error("No se puede crear el bat temporal");
				log.error(e.toString());
			}
	}
}
